Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remote-ui/types

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remote-ui/types

This library provides a couple of utility types used in other remote-ui libraries. All of these types are re-exported from [`@remote-ui/core`](../core).

  • 1.1.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
38K
decreased by-32.47%
Maintainers
3
Weekly downloads
 
Created
Source

@remote-ui/types

This library provides a couple of utility types used in other remote-ui libraries. All of these types are re-exported from @remote-ui/core.

Types

RemoteComponentType<Type, Props, AllowedChildren>

A “type” in remote-ui is represented with a humble string. You pass a string to RemoteRoot#createComponent](../core#remoterootcreatecomponent) in order to create a new component instance, and a string identifier for the component is the only required argument. However, many of the remote-ui libraries have support for a more strongly-typed version of that string, which is the purpose of RemoteComponentType. This type is still “just a string”, but includes additional type parameters for the type of the properties allowed for that component, and for the types of components this component accepts as children. The [RemoteComponent` APIs, as well as a number of others, use these types to offer you editor autocompletion on property names, and other helpful type checking.

The AllowedChildren argument does not perform any runtime validation, it only provides compile-time checking to ensure value children are appended to a component. If your component accepts any child, including being able to accept text nodes as children, you can pass true for this type parameter (or leave it unset, as the default is true).

IdentifierForRemoteComponent<Type>

If the Type parameter is a RemoteComponentType, this will extract the exact string type that is that component’s unique name.

type Button = RemoteComponent<'Button', {onPress(): void}>;
type ButtonType = IdentifierForRemoteComponent<Button>; // 'Button'

PropsForRemoteComponent<Type>

If the Type parameter is a RemoteComponentType, this will extract the props type for that component

type Button = RemoteComponent<'Button', {onPress(): void}>;
type ButtonType = PropsForRemoteComponent<Button>; // {onPress(): void}

FAQs

Package last updated on 05 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc